#include "TcpServer.hh"

TcpServer::TcpServer(string ip, unsigned short port)
    : _acceptor(ip, port)
    , _loop(_acceptor){

}

TcpServer::~TcpServer(){

}

void TcpServer::Start(){
    _acceptor.Ready();
}

void TcpServer::Set_callback(const func_ptr& new_, const func_ptr& old_, const func_ptr& close_){
    _loop.Set_new_conn(new_);
    _loop.Set_old_conn(old_);
    _loop.Set_close_conn(close_);
}

void TcpServer::Loop(){
    _loop.Loop();
}